Skip to content

Instantly share code, notes, and snippets.

@letsspeak
Last active December 15, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letsspeak/5272917 to your computer and use it in GitHub Desktop.
Save letsspeak/5272917 to your computer and use it in GitHub Desktop.
centos cpu usage one liner
# cpu usage (decimal)
cat /proc/loadavg | cut -d ' ' -f 1
# cpu usage (integral)
cat /proc/loadavg | cut -d ' ' -f 1 | cut -d '.' -f 1
# cpu usage (integral * 100)
cpu=`cat /proc/loadavg | cut -d ' ' -f 1`;echo $cpu*100 | bc | cut -d '.' -f 1
# send your cpu usage (integral) to GrowthForecast every 5 minutes via crontab
*/5 * * * * curl -F number=`cat /proc/loadavg | cut -d ' ' -f 1 | cut -d '.' -f 1` http://localhost:5125/api/yourmachine/system/cpu 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment